source("../r/fig1_proxies4intervention.r")
source("/r/fig1_proxies4intervention.r")
setwd("~/Dropbox/old structural poli sci papers/intervention/paper/JOPsubmission/final_submission/replication")
source("/r/fig1_proxies4intervention.r")
source("/r/fig2_interventionAndPeace.r")
source("/r/fig3_eqSelectionEffects.r")
source("/r/fig1_proxies4intervention.r")
setwd("~/Dropbox/old structural poli sci papers/intervention/paper/JOPsubmission/final_submission/replication")
source("r/fig1_proxies4intervention.r")
source("r/fig1_proxies4intervention.r")
source("r/fig1_proxies4intervention.r")
source("r/fig2_interventionAndPeace.r")
source("r/fig1_proxies4intervention.r")
source("r/fig2_interventionAndPeace.r")
CFpe <- read.csv("matlab/baseline_model/selection_prpeace.csv")
CFpe <- read.csv("matlab/baseline_model/selection_prpeace_replication.csv")
CFpe[,3:11]  <-100*read.csv("selection_prpeace.csv")[,3:11]
CFpe
dim(CFpe)
head(CFpe)
rm(list=ls())
library('reshape2')
library('dplyr')
library('matrixStats')
library('ggplot2')
CFpe <- read.csv("matlab/baseline_model/selection_prpeace_replication.csv")
CFpe[,3:6]  <- 100*CFpe[,3:6]
CFpe <- read.csv("matlab/baseline_model/selection_prpeace_replication.csv")
CFpe[,3:6]  <- 100*CFpe[,3:6]
cf_labs <- c("Max peace", "Max conflict", "Best rebel")
cv <- 1.96
colMeans(select(CFpe, -one_of(c("ccode","countrycode","data"))))
rm(list=ls())
library('reshape2')
library('dplyr')
library('matrixStats')
library('ggplot2')
CFpe <- read.csv("matlab/baseline_model/selection_prpeace_replication.csv")
CFpe[,3:6]  <- 100*CFpe[,3:6]
cf_labs <- c("Max peace", "Max conflict", "Best rebel")
cv <- 1.96
Mpe <- as.matrix(select(CFpe, -one_of(c("ccode","countrycode","data"))))
ggdat <- data.frame(means = colMeans(Mpe),
sds = colSds(mpe),
cf = cf_labs,
var = rep("Probability of Peace", each=4))
ggdat2 <- data.frame(var=factor(c("Probability of Peace", "Number of Interveners"), levels = c("Probability of Peace", "Number of Interveners")),
Z=c(mean(CFpe$data),mean(CFen$data)),
W = c(sd(CFpe$data),sd(CFen$data)),
X = c(0.5, 8.5),
Y = c(0.75, 0.75)
)
ggdat_use <- subset(ggdat,
cf %in% c("Max peace", "Max conflict") &
var == "Probability of Peace")
plot_peace <- ggplot(ggdat_use) +
geom_pointrange(aes(x=factor(cf, levels=cf_labs), y=means, ymax=means+cv*sds, ymin=means-cv*sds), size=0.75) +
theme_bw(18) + ylab("Probability of Peace") + xlab("Selection Mechanism")  +
geom_hline(data=ggdat2[1,], aes(yintercept = Z), linetype="dashed", color="black", size=1.2) +
geom_rect(data = ggdat2[1,], aes(ymin = Z-cv*W, ymax = Z+cv*W),
xmin=1-1,
xmax=3+1,
fill="black", alpha=0.25) +
theme(axis.title.x=element_text(margin = margin(t = 15, r = 0, b = 0, l = 0)))
ggdat_use <- subset(ggdat,
cf %in% c("Max peace", "Max conflict") &
var == "Probability of Peace")
ggdat <- data.frame(means = colMeans(Mpe),
sds = colSds(mpe),
cf = cf_labs,
var = rep("Probability of Peace", each=4))
ggdat <- data.frame(means = colMeans(Mpe),
sds = colSds(Mpe),
cf = cf_labs,
var = rep("Probability of Peace", each=4))
ggdat2 <- data.frame(var=factor(c("Probability of Peace", "Number of Interveners"), levels = c("Probability of Peace", "Number of Interveners")),
Z=c(mean(CFpe$data),mean(CFen$data)),
W = c(sd(CFpe$data),sd(CFen$data)),
X = c(0.5, 8.5),
Y = c(0.75, 0.75)
)
ggdat_use <- subset(ggdat,
cf %in% c("Max peace", "Max conflict") &
var == "Probability of Peace")
plot_peace <- ggplot(ggdat_use) +
geom_pointrange(aes(x=factor(cf, levels=cf_labs), y=means, ymax=means+cv*sds, ymin=means-cv*sds), size=0.75) +
theme_bw(18) + ylab("Probability of Peace") + xlab("Selection Mechanism")  +
geom_hline(data=ggdat2[1,], aes(yintercept = Z), linetype="dashed", color="black", size=1.2) +
geom_rect(data = ggdat2[1,], aes(ymin = Z-cv*W, ymax = Z+cv*W),
xmin=1-1,
xmax=3+1,
fill="black", alpha=0.25) +
theme(axis.title.x=element_text(margin = margin(t = 15, r = 0, b = 0, l = 0)))
rm(list=ls())
library('reshape2')
library('dplyr')
library('matrixStats')
library('ggplot2')
CFpe <- read.csv("matlab/baseline_model/selection_prpeace_replication.csv")
CFpe[,3:6]  <- 100*CFpe[,3:6]
cf_labs <- c("Max peace", "Max conflict", "Best rebel")
cv <- 1.96
Mpe <- as.matrix(select(CFpe, -one_of(c("ccode","countrycode","data"))))
ggdat <- data.frame(means = colMeans(Mpe),
sds = colSds(Mpe),
cf = cf_labs,
var = rep("Probability of Peace", each=4))
cf_labs
rm(list=ls())
library('reshape2')
library('dplyr')
library('matrixStats')
library('ggplot2')
CFpe <- read.csv("matlab/baseline_model/selection_prpeace_replication.csv")
CFpe[,3:6]  <- 100*CFpe[,3:6]
cf_labs <- c("Max peace", "Max conflict", "Best rebel")
cv <- 1.96
Mpe <- as.matrix(select(CFpe, -one_of(c("ccode","countrycode","data"))))
ggdat <- data.frame(means = colMeans(Mpe),
sds = colSds(Mpe),
cf = cf_labs,
var = rep("Probability of Peace", each=3))
ggdat2 <- data.frame(var="Probability of Peace",
Z=c(mean(CFpe$data)),
W = c(sd(CFpe$data)),
X = c(0.5,),
Y = c(0.75))
ggdat_use <- subset(ggdat,
cf %in% c("Max peace", "Max conflict") &
var == "Probability of Peace")
rm(list=ls())
library('reshape2')
library('dplyr')
library('matrixStats')
library('ggplot2')
CFpe <- read.csv("matlab/baseline_model/selection_prpeace_replication.csv")
CFpe[,3:6]  <- 100*CFpe[,3:6]
cf_labs <- c("Max peace", "Max conflict", "Best rebel")
cv <- 1.96
Mpe <- as.matrix(select(CFpe, -one_of(c("ccode","countrycode","data"))))
ggdat <- data.frame(means = colMeans(Mpe),
sds = colSds(Mpe),
cf = cf_labs,
var = rep("Probability of Peace", each=3))
ggdat2 <- data.frame(var="Probability of Peace",
Z=c(mean(CFpe$data)),
W = c(sd(CFpe$data)),
X = 0.5,
Y = 0.75)
ggdat_use <- subset(ggdat,
cf %in% c("Max peace", "Max conflict") &
var == "Probability of Peace")
plot_peace <- ggplot(ggdat_use) +
geom_pointrange(aes(x=factor(cf, levels=cf_labs), y=means, ymax=means+cv*sds, ymin=means-cv*sds), size=0.75) +
theme_bw(18) + ylab("Probability of Peace") + xlab("Selection Mechanism")  +
geom_hline(data=ggdat2[1,], aes(yintercept = Z), linetype="dashed", color="black", size=1.2) +
geom_rect(data = ggdat2[1,], aes(ymin = Z-cv*W, ymax = Z+cv*W),
xmin=1-1,
xmax=3+1,
fill="black", alpha=0.25) +
theme(axis.title.x=element_text(margin = margin(t = 15, r = 0, b = 0, l = 0)))
plot_peace
rm(list=ls())
library('reshape2')
library('dplyr')
library('matrixStats')
library('ggplot2')
CFpe <- read.csv("matlab/baseline_model/selection_prpeace_replication.csv")
CFpe[,3:6]  <- 100*CFpe[,3:6]
cf_labs <- c("Max peace", "Max conflict", "Best rebel")
cv <- 1.96
Mpe <- as.matrix(select(CFpe, -one_of(c("ccode","countrycode","data"))))
ggdat <- data.frame(means = colMeans(Mpe),
sds = colSds(Mpe),
cf = cf_labs,
var = rep("Probability of Peace", each=3))
ggdat2 <- data.frame(var="Probability of Peace",
Z=c(mean(CFpe$data)),
W = c(sd(CFpe$data)),
X = 0.5,
Y = 0.75)
ggdat_use <- subset(ggdat,
cf %in% c("Max peace", "Max conflict") &
var == "Probability of Peace")
plot_peace <- ggplot(ggdat_use) +
geom_pointrange(aes(x=factor(cf, levels=cf_labs), y=means, ymax=means+cv*sds, ymin=means-cv*sds), size=0.75) +
theme_bw(18) + ylab("Probability of Peace") + xlab("Selection Mechanism")  +
geom_hline(data=ggdat2[1,], aes(yintercept = Z), linetype="dashed", color="black", size=1.2) +
geom_rect(data = ggdat2[1,], aes(ymin = Z-cv*W, ymax = Z+cv*W),
xmin=1-1,
xmax=3+1,
fill="black", alpha=0.25) +
theme(axis.title.x=element_text(margin = margin(t = 15, r = 0, b = 0, l = 0)))
ggsave("fig3.pdf", plot_peace, height=4, width=6.5)
source("r/fig1_proxies4intervention.r")
source("r/fig2_interventionAndPeace.r")
source("/r/fig3_eqSelectionEffects.r")
source("r/fig1_proxies4intervention.r")
source("r/fig2_interventionAndPeace.r")
source("r/fig3_eqSelectionEffects.r")
source("r/fig1_proxies4intervention.r")
source("r/fig2_interventionAndPeace.r")
source("r/fig3_eqSelectionEffects.r")
